global without sharing class PerformanceRightsConfirmationHandler {
    
	//设置唯一主键
    public static void updateOnly(List<PerformanceRightsConfirmation__c> prList ){
		for (PerformanceRightsConfirmation__c rc :prList ) {
			String key1 = rc.Year__c +'-'+rc.Quarter__c+'-'+rc.AccountPK__c+'-'+rc.TerminalPK__c+'-'+rc.Company__c +'-'+rc.Province__c ;
			rc.Only__c = key1;
		}
	}

	WebService static String summitApporval(String id){

		try {

	
			Approval.ProcessSubmitRequest req1 = new Approval.ProcessSubmitRequest(); 

                req1.setObjectId(id);
                Approval.ProcessResult result = Approval.process(req1);  
                if( result != null && result.getErrors() != null &&  result.getErrors().size()> 0 ) {

                    throw  new DmlException(result.getErrors()[0].getMessage());
                }
		    
		    return '确认成功!';
		}
		catch (Exception e) {
		    
		    return '确认失败:'+ e.getMessage();
		}
		
	}
}